layui.use(['form','layer'],function(){
    var layer = parent.layer === undefined ? layui.layer : top.layer,
        $ = layui.jquery;

    // 根据表单里的任务ID，获取审批页面的详情
    setTimeout(function(){
        $.get("/qjlc/detailByPIIdAndLBId",{
            processInstanceId : $(".processInstanceId").val(),
            leaveBillId : $(".businessKey").val()
        },function (res){
            $(".username").val(res.data.leaveBill.user.username);
            $(".createDate").val(res.data.leaveBill.leaveDate);
            $(".days").val(res.data.leaveBill.days);
            $(".content").val(res.data.leaveBill.content);
            $(".remark").val(res.data.leaveBill.remark);

            var content = "";
            $.each(res.data.commentList, function (index, item) {
                content += item.userId + "：" + item.message + "\r\n";
            });
            $(".historyCommont").val(content);
        })
    }, 50);

    // 取消按钮
    $(".cancle_btn").click(function(){
        var index=parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    })

});